package com.example.yiqiuser.service.impl;


import com.example.yiqiuser.dao.VisitorDao;
import com.example.yiqiuser.entity.Visitor;
import com.example.yiqiuser.service.VisitorService;
import com.example.yiqiuser.util.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author: Jyc
 * @classname: VisitorServiceImpl
 * @date: 2023/3/30
 * @time: 20:31
 * @description:
 */
@Service
public class VisitorServiceImpl implements VisitorService {
    @Resource
    private VisitorDao visitorDao;


    @Override
    public Visitor queryByPhoneNumAndPassword(Visitor visitor) {
        return visitorDao.queryByPhoneNumAndPassword(visitor);
    }

    @Override
    public Visitor queryByAccountAndPassword(Visitor visitor) {
        return visitorDao.queryByAccountAndPassword(visitor);
    }

    @Override
    public PageInfo queryByParam(Page<Visitor> page) {
        PageHelper.startPage(page.getPageNo(),page.getPageSize());
        return new PageInfo<Visitor>(visitorDao.queryByParams(page.getData()));
    }

    @Override
    public int adds(Visitor visitor) {
        return visitorDao.adds(visitor);
    }

    @Override
    public int deleteById(int id) {
        return visitorDao.deleteById(id);
    }

    @Override
    public int update(Visitor visitor) {
        return visitorDao.update(visitor);
    }
}
